package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbSellerMapper;
import com.dongdongshop.pojo.TbSeller;
import com.dongdongshop.service.SellerService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
@DubboService
public class SellerServiceImpl implements SellerService {

    @Resource
    private TbSellerMapper tm;


    @Override
    public void insertSeller(TbSeller seller) {
        tm.insertSelective(seller);
    }

    @Override
    public int audit(String[] ids, String status) {
        for (String id:ids){
            TbSeller tbSeller = tm.selectByPrimaryKey(id);
            tbSeller.setStatus(status);
            tm.updateByPrimaryKeySelective(tbSeller);
        }
        return 1;
    }

    @Override
    public List<TbSeller> getAll() {
        return tm.selectByExample(null);
    }

    @Override
    public List<TbSeller> sellerList(String name, String nickName) {
        return tm.selectList(name,nickName);
    }
}
